#include<stdio.h>

#define OFFSET ('a' - 'A')

void caps(char * str);
void find_M(const char *str, char *max_c, char *min_c);
int main(int argc, char *argv[])
{
	char str[] = "alsfhalHSAJKDLFHALSKJDHF";
	char max_char;
	char min_char;
	puts(str);
	caps(str);
	puts(str);
	
	find_M(str, &max_char, &min_char);
	putchar(max_char);
	putchar(min_char);

	return 0;
}

void caps(char * str){
	while(*str){
		if(*str >= 'a' && *str <= 'z' ){
			*str = *str - OFFSET;
		}else if(*str >= 'A' && *str <='Z'){
			*str = *str + OFFSET;
		}	
		str++;
	}
}

void find_M(const char *str, char *max_c, char *min_c){
	char max;
	char min;
	max = min = str[0];
	while(*str){
		if(*str > max){
			max = *str;
		}
	   	if(*str < min){
			min = *str;
		}
		str++;
	}
	*max_c = max;
	*min_c = min;
}
